<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>课程定单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" >
    <script th:src="@{/layui/layui.js}" charset="utf-8"></script>
   </head>
<body>
<form class="layui-form" action="" id="form1">
    <div style="height: 20px"></div>
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-inline">
            <input type="text" name="name" lay-verify="title" autocomplete="off" placeholder="请输入姓名" class="layui-input">
        </div>
        <label class="layui-form-label">WeChat号</label>
        <div class="layui-input-inline">
            <input type="text" name="wechat_no"  placeholder="请输入WeChat号" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">WeChat备注</label>
        <div class="layui-input-inline">
            <input type="text" name="wechat_mark"  placeholder="请输入WeChat备注" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">QQ号</label>
        <div class="layui-input-inline">
            <input type="text" name="qq_no"  placeholder="请输入QQ号" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-inline">
            <input type="text" name="tel" placeholder="请输入手机号" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">购买课程</label>
        <div class="layui-input-inline">
            <select name="course_name"  lay-search="">
                <option value="">请选择购买课程</option>
                <option value="2018Java全套课程">2018Java全套课程</option>
                <option value="郭永峰IT交流群">郭永峰IT交流群</option>
            </select>
        </div>
        <label class="layui-form-label">购买价格</label>
        <div class="layui-input-inline">
            <input type="text" name="course_price" placeholder="请输入购买价格" autocomplete="off" class="layui-input">
        </div>

        <label class="layui-form-label">购买日期</label>
        <div class="layui-input-inline">
            <input type="text" name="order_date" id="date" lay-verify="date" placeholder="请选择日期" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block" style="width: 600px">
            <textarea name="remark" placeholder="备注" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" layui-btn type="button" onclick="saveAction();">保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script th:inline="none">

    var form,layer,layedit,laydate,$;
    layui.use(['form', 'layedit', 'laydate'], function() {
        form = layui.form;
        layer = layui.layer;
        layedit = layui.layedit;
        laydate = layui.laydate;
        $ = layui.jquery;

        //日期
        laydate.render({
            elem: '#date'
        });
    });

    function saveAction() {
        var formData = $("#form1").serialize();
        $.post("/courseorder/save",formData,function(message){
            if(message.success == 1){
                layer.alert("添加成功",{yes:function () {
                    parent.layer.closeAll();
                }});
            }else{
                layer.alert("添加失败",{yes:function () {
                    parent.layer.closeAll();
                }});
            }
        });
    }


</script>
</body>
</html>
